package esi.t2no1.ws.service;

import javax.jws.WebParam;
import javax.jws.WebService;

import org.apache.cxf.annotations.Policy;

import esi.t2no1.ws.model.ContractOutput;
import esi.t2no1.ws.model.CreateContractInput;
import esi.t2no1.ws.model.CreateContractOutput;

/**
 * The ClientService is the service endpoint for the communication between the
 * electricity suppliers and the network owner (us).
 * 
 * @author Kaarel Jõgeva
 */
@WebService(serviceName = "ClientService")
@Policy(uri = "classpath:rm-policy.xml", includeInWSDL = true, placement = Policy.Placement.DEFAULT)
public interface ClientService {

	/**
	 * Creates a new contract between an electricity supplier (on behalf of the
	 * client) and the network owner (us). When creating the contract we can
	 * have two different scenarios:
	 * a) No existing contract exists for the client.
	 * 	1. We check if the submitted information is correct.
	 * 	2. If everything correct, send a positive response and continue, else
	 * 	return negative response and stop.
	 * 	3. A new contract will be created for the new electricity supplier.
	 * b) A contract already exists for the client.
	 * 	1. We check if the submitted information is correct and if a change
	 * 	request has already been made for the same date.
	 * 	2. If everything correct, send a positive response and continue, else
	 * 	return negative response and stop.
	 * 	3. Send a notification message to the old (existing) supplier.
	 * 	4. Send the preliminary load shares and the metering data to the old
	 * 	and new supplier.
	 * 	5. Create (update) the contract for the new electricity supplier.
	 * 
	 * @param input the basis information for the new contract
	 * @return the created contract number on success, else return a soap fault
	 * 	       message
	 */
	CreateContractOutput createContract(
			@WebParam(name = "createContractInput") CreateContractInput input);

	/**
	 * Get an exiting contract.
	 * 
	 * @param contractNumber the number of the contract in our database
	 * @return the contract if found, else a soap fault message
	 */
	ContractOutput getContract(
			@WebParam(name = "contractNumber") String contractNumber);
}
